﻿using System;
using DC2010.Objects;
using DC2010.Objects.Base;
using DC2010.Objects.Data;

namespace DC2010.Effects
{
    public class P_Poison_Effect : EffectLogic
    {
        public P_Poison_Effect(EffectData ed)
            : base(ed)
        {
            ShortName = "INCREASE STAT";
            LongName = "Effect increases/decreses specific stat for creature.";
            Id = "I_INCREASE_STAT_EFFECT";
            EffectType = EffectType.Pump;
        }

        public override void Pump(BaseObject aTarget)
        {
            DateTime dtStart = DateTime.Now;
            int amount = Data.Params.Find(A => A.Key == "AMOUNT").Value.ToInt();

            if (CheckPumpCondition(aTarget))
            {
                if (aTarget is CreatureData)
                {
                    CreatureData aCreature = (CreatureData)aTarget;

                    aCreature.Attributes.Health.Incr(-amount);
                    if (aCreature.Attributes.Health.Current <= 0) aCreature.L.Die();
                }
            }

            if ((DateTime.Now - dtStart).TotalSeconds > 0)
                log.Debug("P_Poison_Effect::Pump() takes: " + (DateTime.Now - dtStart).TotalSeconds + " seconds");
        }
    }
}
